<form method="POST" action="?opt=update&id=<?php echo $id; ?>" onsubmit="return Checkurl(this);" enctype="multipart/form-data">
<table width="100%" style="padding-left:10px; line-height:2" cellpadding="0" cellspacing="0">   
    <tr>
		<td height="10"></td>
	</tr>
	<tr>
        <td>&nbsp;</td>
      <td> 
            <input type="submit" class="b1" value="<?echo _SAVE?>">
			<input type="reset" class="b1"  value="<?echo _RESET?>">
            <input type="button" class="b1"  value="<?echo _BACK?>" onclick="history.back();"> 
		</td>
    </tr>
	</tr>
    	<tr>
		<td height="10"></td>
	</tr>
	 <tr>
        <td><b><font color="Red"><?echo _URL?></font></b></td>
        <td><input class="normal3" type="text" name="URL"  id="URL" value="<?php echo $categories["cUrlString"] ?>" />
		<span style="color:#FF0000; padding-left:10" id="div_url"></span>
             </td>
    </tr>
	<tr>
        <td width="15%"><span class="style1"><?echo _NAME?></span></td>
        <td><input class="normal3" type="text" name="CategoryName" id="CategoryName"
			 value="<?php echo $categories["cCategoryName"] ?>" /></td>
    </tr>
    <tr>
        <td width="15%"><b><?echo _TITLE?></b></td>
        <td><input class="normal3" type="text" name="Title" id="Title" value="<?php echo $categories["cTitle"] ?>" /></td>
    </tr>
    <tr>
        <td width="15%"><b><?echo _SOLOGAN?></b></td>
        <td><input class="normal3" type="text" name="Sologan" id="Sologan" value="<?php echo $categories["cSologan"] ?>"/></td>
    </tr>
    <tr>
      <td><b><?echo _TAGS?></b></td >
      <td><input type="text" id="Tag" name="Tag" class="normal3" value="<?php echo $tag["cTag"]?>"/></td>
    </tr>
	<?
	if($categories["iParentId"]>0)
	{
	?>
	<tr>
        <td><b><?echo _PARENTCATEGORY?></b></td>
        <td>
	        <select name="ParentCategory" id="ParentCategory">
	        	<?php echo List_CategoriesBox($categories["iParentId"],$typeModunle)?>
	        </select>       
		</td>
    </tr>   
	<?
	}else
	{
	?>
		<input type="hidden" name="ParentCategory" value="0" />
	<?
	}
	?>
    <tr>
      <td><strong><?echo _INTROIMAGE?></strong></td>
      <td>
      <select name="ImgIntro" id="ImgIntro"  style="width:170">
			  	<?php 
					$folder = "../images/category/";
					echo BuildFileList($categories["cImages"],$folder)
					?>
			</select>
          <input class="normal3" type="file" name="ImgFileIntro" id="ImgFileIntro" style="width:200px" />
      </td>
    </tr>
    <tr>
        <td><b>Banner Image</b></td>
      <td>
     <select name="ImgBanner" id="ImgBanner"  style="width:170">
					<?php 
					$folder = "../images/banner/";
					echo BuildFileList($categories["cBanner"],$folder)
					?>
			</select>
	    	<input class="short" type="file" name="ImgFileBanner" id="ImgFileBanner" style="width:200px">
			
		<b>Alt Text:</b><input class="short" name="BannerTitle" type="text" id="BannerTitle" 
		value="<?php echo $categories["cBannerTitle"] ?>" style="width:250px" />
		<span style="color:#FF0000; padding-left:10" id="div_banner"></span>
		      </td>
    </tr>
    <tr>
        <td><b><?echo _ORDER?></b></td>
        <td>
        	<input type="text" name="Order" id="Order" value="<?echo $categories["iOrdering"]?>" maxlength="3" style="width:50"/>
			&nbsp;<b><?echo _STATUS?></b>
			<select name="Status" id="Status">
				<?echo liststatusyesno($categories['cStatus'])?>
			</select>
	     </td>
    </tr>
   		<tr>
        <td><b><?echo _METATITLE?></b></td>
        <td><input class="normal3" type="text" name="MetaTitle" id="MetaTitle"
		 value="<?php echo $categories["cMetaTitle"] ?>" /></td>
	</tr>
	 <tr>
	        <td><b><?echo _METAKEYWORDS?></b></td>
	        <td><input class="normal3" style="width:90%" type="text" name="MetaKeywords" id="MetaKeywords" 
			value="<?php echo $categories["cMetaKeywords"] ?>"  /></td>
	 </tr>
	 <tr>
	        <td valign="top" style="vertical-align:top"><b><?echo _METADESCRIPTIONS?></b></td>
	        <td style="padding-bottom:10"><textarea style="height:70px; width:90%;" id="MetaDescription" 
			name="MetaDescription" class="noeditor" ><?php echo $categories["cMetaDescription"] ?></textarea></td>
	</tr>
	
    <tr>
	        <td valign="top" style="vertical-align:top"><b><?echo _DESCRIPTION?></b></td>
	        <td><textarea style="height:350px; width:90%;" id="Description"
					 name="Description"><?php echo $categories["cDescription"] ?></textarea></td>
	    </tr>
    <tr>
        <td colspan="2">&nbsp;</td>                       
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td> 
            <input type="submit" class="b1"  value="<?echo _SAVE?>">        
            <input type="reset" class="b1"  value="<?echo _RESET?>">
            <input type="button" class="b1"  value="<?echo _BACK?>" onclick="history.back();"> 
       </td>
    </tr>
</table>
</form>
<script language="javascript" type="text/javascript">
var checked=false;
function Checkurl(f)
{
		if(checked)return true;
		if(navigator.appName == "Microsoft Internet Explorer") {
			http = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			http = new XMLHttpRequest();
		}
		http.abort();
		http.open("POST", f.action, true);
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

		http.onreadystatechange=function() 
		{
			if(http.readyState == 1)
			{
			  document.getElementById("div_url").innerHTML = 'URL Checking...';
			}
		   if (http.readyState == 4 && http.status == 200)
			{
				dt = http.responseText;
				erraray = dt.split('^$^');		
				if(erraray[1]=="ok")
				{
					checked=true;
					f.submit();
				}
				document.getElementById("div_url").innerHTML = erraray[2];
				f.URL.focus();
			 }
		 }
		 if(f.URL.value=="")
		 {
		 	f.URL.value=f.CategoryName.value;
		 }
		
		post = "ajax=check";
		post+="&URL="+f.URL.value;
		post+="&ParentCategory="+f.ParentCategory.value;
		http.send(post);
		return checked;
}
</script>
